USE [PGI]
GO
/****** Object:  StoredProcedure [dbo].[MntCategoriaI]    Script Date: 11/08/2013 02:00:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		JAM
-- Create date: 05/11/2013
-- Description:	Inserta Categorias 
-- =============================================
ALTER PROCEDURE [dbo].[MntCategoriaI]
	@SubCategoriaID INT,
	@Descripcion NVARCHAR (100),
	@Resultado INT OUTPUT
AS
BEGIN
	BEGIN TRY
		BEGIN TRANSACTION
		
			INSERT INTO [PGI].[dbo].[MntCategoria]
				   ([SubCategoriaID]
				   ,[Descripcion]
				   ,[Estado])
			 VALUES
				   (@SubCategoriaID
				   ,@Descripcion
				   ,1)
		           		
			SET @Resultado = SCOPE_IDENTITY()
		
		COMMIT TRANSACTION
	END TRY
	BEGIN CATCH
	
		ROLLBACK TRANSACTION
		
		SET @Resultado = 0
	
	END CATCH			
END
